@section('title', "题库管理")
@section('content_title', '题库管理')
@section('content_title_small',  $pager->total())
@section('content')
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header width-border">
                        <h3 class="box-title">搜索</h3>
                    </div>
                    <div class="box-body">
                        <div class="row">
                            <form action="{{ url('issue') }}" method="get">
                                <div class="col-lg-2">
                                    <input name="search" value="{{ Input::get('search','') }}" class="form-control"
                                           placeholder="题目"/>
                                </div>
                                <div class="col-lg-2">
                                    <select name="course_id" class="form-control">
                                        <option value=""  > 请选择 </option>
                                        @foreach($course as $k =>$item)
                                            <option value="{{$item['id']}}" @if(Input::get('course_id') == $item['id'] ) selected @endif > {{$item['name']}} </option>
                                        @endforeach
                                    </select>

                                </div>
                                <div class="form-group col-lg-4">
                                    <div class="input-group">
                                        <div class="input-group-addon">创建时间</div>
                                        <input type="text" class="form-control datepicker" name="startTime"
                                               id="startTime" value="{{ Input::get('startTime','') }}">

                                        <div class="input-group-addon">至</div>
                                        <input type="text" class="form-control datepicker" name="endTime" id="endTime"
                                               value="{{ Input::get('endTime','') }}">
                                    </div>
                                </div>

                                <div class="col-lg-2">
                                    <button type="submit" class="btn btn-default">搜索</button>
                                    <button type="button" style="margin-left:5px;" class="btn btn-default"
                                            onclick="location.href='{{ url('issue') }}'">重置
                                    </button>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
                <div class="box">
                    <div class="box-header with-border">
                        <button type="button" onclick="location='{{ $base_url . "/issue/edit" }}';" class="btn btn-success">添加题库</button>
                    </div>
                    <div class="box-body">
                        <?php $course_arr = [86=>'消防','201'=>'茶艺','301'=>'楼宇','401'=>'汽修','501'=>'钳工','601'=>'低压电工','701'=>'高压电工','801'=>'焊工','901'=>'高空作业'] ?>
                        <table class="table table-bordered text-center">
                            <tr>
                                <th width="80px">ID</th>
                                <th width="80px">分类</th>
                                <th>题目</th>
                                <th width="100px">操作</th>
                            </tr>
                            @if(true == isset($pager))

                                @foreach ($pager as $item)

                                    <tr>
                                        <td>{{ $item->id }}</td>
                                        <td>{{ $course_arr[$item->course_id]}}</td>
                                        <td style="text-align: left;">{{ $item->question }}</td>
                                        <td><a href="{{ $base_url . "/issue/{$item['id']}/edit" }}">编辑</a></td>

                                    </tr>
                                @endforeach
                            @endif
                        </table>
                    </div>
                    @include('admin.common.pager')
                </div>
            </div>
        </div>
    </section>
@endsection
@section('css')
    <link rel="stylesheet" href="{{ $assets_url }}/static/plugins/datepicker/datepicker3.css">
    <style>
        .disabled.day {
            color: #ddd !important;
        }
    </style>
@endsection
@section('js')
    <script src="{{ $assets_url }}/static/plugins/datepicker/bootstrap-datepicker.js"></script>
    <script>
        $.fn.datepicker.dates['zh-CN'] = {
            days: ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
            daysShort: ["日", "一", "二", "三", "四", "五", "六", "日"],
            daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
            months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
            monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
            today: "今天",
            clear: "清除",
        }
        $(".datepicker").datepicker(
                {
                    format: "yyyy-mm-dd",
                    language: 'zh-CN',
                    todayHighlight: true,
                    autoclose: true,
                }
        );
        $("#startTime").change(function () {
            $(".datepicker").datepicker('setStartDate', $("#startTime").val());
        });
        $("#endTime").change(function () {
            $(".datepicker").datepicker('setEndDate', $("#endTime").val());
        });
    </script>
@endsection
@extends('layouts.admin')